package cn.edu.hizee.gps.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "t_device", schema = "EHelp", catalog = "")
public class Device {
    private int id;
    private String deviceNumber;
    private String activeTime;
    private String lastOpen;
    private Integer isDisable = 1;
    private Integer status = 1;
    private Integer isBind = 1;

    public Device(String deviceNumber, String activeTime, String lastOpen) {
        this.deviceNumber = deviceNumber;
        this.activeTime = activeTime;
        this.lastOpen = lastOpen;
    }

    public Device() {
    }

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "device_number")
    public String getDeviceNumber() {
        return deviceNumber;
    }

    public void setDeviceNumber(String deviceNumber) {
        this.deviceNumber = deviceNumber;
    }

    @Basic
    @Column(name = "active_time")
    public String getActiveTime() {
        return activeTime;
    }

    public void setActiveTime(String activeTime) {
        this.activeTime = activeTime;
    }

    @Basic
    @Column(name = "last_open")
    public String getLastOpen() {
        return lastOpen;
    }

    public void setLastOpen(String lastOpen) {
        this.lastOpen = lastOpen;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Device device = (Device) o;
        return id == device.id &&
                Objects.equals(deviceNumber, device.deviceNumber) &&
                Objects.equals(activeTime, device.activeTime) &&
                Objects.equals(lastOpen, device.lastOpen);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, deviceNumber, activeTime, lastOpen);
    }

    @Basic
    @Column(name = "is_disable")
    public Integer getIsDisable() {
        return isDisable;
    }

    public void setIsDisable(Integer isDisable) {
        this.isDisable = isDisable;
    }

    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "is_bind")
    public Integer getIsBind() {
        return isBind;
    }

    public void setIsBind(Integer isBind) {
        this.isBind = isBind;
    }
}
